package com.turing.post.transaction.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;

@SuppressWarnings("serial")
@Entity
@Table(name = "MCHBSTYPETRADDETAIL")
@IdClass(MchBsTypeTradDetail.class)
public class MchBsTypeTradDetail implements Serializable {
	/**
	 * 商户ID
	 */
	private String merchantNo;

	/**
	 * 帐务日期
	 */
	private Date tranDate;

	/**
	 * 流水号
	 */
	private String tranSeqNo;

	/**
	 * 业务类型
	 */
	private String businessType;

	/**
	 * 预付卡发生额
	 */
	private BigInteger cardAmount;

	/**
	 * 积分发生额
	 */
	private BigInteger scoreAmount;

	/**
	 * 其他发生额
	 */
	private BigInteger otherAmount;

	@Id
	@Column(name = "MERCHANTNO", nullable = false)
	public String getMerchantNo() {
		return merchantNo;
	}

	public void setMerchantNo(String merchantNo) {
		this.merchantNo = merchantNo;
	}

	@Id
	@Column(name = "TRANDATE", nullable = false)
	public Date getTranDate() {
		return tranDate;
	}

	public void setTranDate(Date tranDate) {
		this.tranDate = tranDate;
	}

	@Id
	@Column(name = "TRANSEQNO", nullable = false)
	public String getTranSeqNo() {
		return tranSeqNo;
	}

	public void setTranSeqNo(String tranSeqNo) {
		this.tranSeqNo = tranSeqNo;
	}

	@Id
	@Column(name = "BUSINESSTYPE", nullable = false)
	public String getBusinessType() {
		return businessType;
	}

	public void setBusinessType(String businessType) {
		this.businessType = businessType;
	}

	@Column(name = "CARDAMOUNT", nullable = false)
	public BigInteger getCardAmount() {
		return cardAmount;
	}

	public void setCardAmount(BigInteger cardAmount) {
		this.cardAmount = cardAmount;
	}

	@Column(name = "SCOREAMOUNT", nullable = false)
	public BigInteger getScoreAmount() {
		return scoreAmount;
	}

	public void setScoreAmount(BigInteger scoreAmount) {
		this.scoreAmount = scoreAmount;
	}

	@Column(name = "OTHERAMOUNT", nullable = false)
	public BigInteger getOtherAmount() {
		return otherAmount;
	}

	public void setOtherAmount(BigInteger otherAmount) {
		this.otherAmount = otherAmount;
	}

	@Override
	public int hashCode() {
		return PCPSUtil.getObjectListHashCode(new Object[] { getMerchantNo(),
				getTranDate(), getTranSeqNo(), getBusinessType() });
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof MchBsTypeTradDetail))
			return false;
		MchBsTypeTradDetail other = (MchBsTypeTradDetail) obj;
		if (!PCPSUtil
				.compareObject(this.getMerchantNo(), other.getMerchantNo()))
			return false;
		if (!PCPSUtil.compareObject(this.getTranDate(), other.getTranDate()))
			return false;
		if (!PCPSUtil.compareObject(this.getTranSeqNo(), other.getTranSeqNo()))
			return false;

		return PCPSUtil.compareObject(this.getBusinessType(), other
				.getBusinessType());
	}
}